package com.xike.micromemberserver.controller;

import com.xike.entiy.ResultBean;
import com.xike.micromemberserver.entity.ExperienceEntity;
import com.xike.micromemberserver.entity.NoteEntity;
import com.xike.micromemberserver.service.ExperienceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Experience)表控制层
 *
 * @author wusong
 * @since 2021-05-09 16:22:06
 */
@Api("心得")
@RestController
@RequestMapping("/member/experience")
public class ExperienceController {
    /**
     * 服务对象
     */
    @Resource
    private ExperienceService experienceService;

    @ApiOperation("新增一条心得")
    @PostMapping("/addOneOne")
    public ResultBean addOneOne(@RequestBody ExperienceEntity experienceEntity) {
        int state = experienceService.insert(experienceEntity);
        return  ResultBean.builder().code(200).msg("成功").build();

    }



    @ApiOperation("查询在某章的所有心得")
    @PostMapping("/selectByCidAndUid")
    public ResultBean selectByCidAndUid(@RequestBody ExperienceEntity experienceEntity) {
        List<NoteEntity> noteEntityList = experienceService.selectByCidAndUid(experienceEntity);
        return  ResultBean.builder().code(200).data(noteEntityList).build();


    }

}
